package exceptions;

import datastructures.Vector2f;

/**
 * 
 * @author Tim
 * @version 0.4.1
 * @since 0.4.0
 */
public abstract class PointException extends Exception{
	
	private static final long serialVersionUID = 6318002609249695523L;
	
	/**
	 * The belonging {@link Point}
	 */
	protected final Vector2f p;
	
	/**
	 * Constructor which accepts a message
	 * @param message MessageString
	 */
	public PointException(String message)
	{
		super(message);
		p = null;
	}
	
	/**
	 * Constructor which accepts a message and the belonging {@link Point}
	 * @param message MessageString
	 * @param p belonging {@link Point}
	 */
	public PointException(String message, Vector2f p) {
		super(message);
		this.p = p;
	}
	
	/**
	 * @return Returns the MessageString, followed by the belonging {@link Point}
	 */
	@Override
	public String getMessage() {
		if (p!=null)
		{
			return super.getMessage() + " Punkt: ("+p.x()+"|"+p.y()+")";
		}
		return super.getMessage();
	}
	
}
